home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / share / Dos / VARIOS / pascal / DELPHI.SWG / 0027_How to tell what kind of drive is used.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-02-21  |  656 b   |  21 lines

  1. {
  2. When dealing with multiple drives, it is helpful to know
  3. whether a drive is associated with a  is attached to a letter
  4. (A, B, C, etc), and what its type is.  This code uses the API
  5. GetDriveType function to do that. }
  6.  
  7. function ShowDriveType(DriveLetter: char): string;
  8. var
  9.   i: word;
  10. begin
  11.   if DriveLetter in ['A'..'Z'] then {Make it lower case.}
  12.     DriveLetter := chr(ord(DriveLetter) + $20);
  13.   i := GetDriveType(ord(DriveLetter) - ord('a'));
  14.   case i of
  15.     DRIVE_REMOVABLE: result := 'floppy';
  16.     DRIVE_FIXED: result := 'hard disk';
  17.     DRIVE_REMOTE: result := 'network drive';
  18.     else result := 'does not exist';
  19.   end;
  20. end;
  21.